package com.woniu.controller;

import com.woniu.pojo.Rolepermission;
import com.woniu.pojo.Userrole;
import com.woniu.service.RolepermissionService;
import com.woniu.service.UserroleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("rolepermission")
public class RolepermissionController {
    @Autowired
    private RolepermissionService rolepermissionService;
    @RequestMapping("assignPermissionDo")
    @ResponseBody
    public Map<String,Object> assignPermissionDo(Integer rid,Integer[] pids){
        Map<String,Object> resutlMap = new HashMap<>();
        try{
            rolepermissionService.assignPermission(rid,pids);
            resutlMap.put("result",true);
        }catch (Exception e){
            resutlMap.put("result",false);
        }
        return resutlMap;
    }

}
